<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>财务订单处理</title>
    <link href="../../rs/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="../../rs/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="../../rs/plugins/bootstrap_tab/css/bootstrap-table.css" rel="stylesheet">
    <link href="../../rs/css/animate.min.css" rel="stylesheet">
    <link href="../../rs/plugins/bootstrap_tab/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="../../rs/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="../../rs/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <link href="../../rs/plugins/bootstrap-editable/css/bootstrap-editable.css" rel="stylesheet">
    <?php
         require_once('login.php');
    ?>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row" style="padding-bottom:10px">
                <div class="col-sm-8">
                    <button onclick="submit_djbh(0)" style=" margin-left:5px;" class="btn btn-danger ">
                          无需结算
                    </button>
                    <button onclick="submit_djbh(1)" style=" margin-left:5px;" class="btn btn-success">
                         待结算
                    </button>
                   
                </div>

                <div class="col-sm-4">
                    <div class="input-group" style="width:300px;float:right;" id="key">
                    <input style="height:34px;" id="searchtext" type="text" placeholder="请输入关键词" class="input-sm form-control"> 
                    <span class="input-group-btn">
                        <button onclick="do_search()" style="height:34px;" type="button" class="btn btn-sm "> 查找</button> 
                        <button onclick="f_sheard()" style="height:34px; margin-left:5px" type="button" class="btn btn-sm "> 刷新</button> 
                    </span>
                      
                </div>
            </div>
        </div>
        <table id="table"></table>
        <!-- End Example Card View -->
    </div>
</div>
</div>
<!-- End Panel Other -->

 

<script src="../../rs/js/jquery.min.js"></script>
<script src="../../rs/js/bootstrap.js"></script>
<script src="../../rs/plugins/bootstrap_tab/js/bootstrap-table.min.js"></script>
<script src="../../rs/plugins/bootstrap_tab/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="../../rs/plugins/datapicker/bootstrap-datepicker.js"></script>
<script src="../../rs/js/jquery.cookie.js"></script>
<script src="../../rs/js/common_qj.js"></script>
<script src="../../rs/plugins/layer/layer.min.js"></script>
<script src="../../rs/plugins/bootstrap-editable/js/bootstrap-editable.js"></script>
<script src="../../rs/plugins/bootstrap_tab/js/plugins/iCheck/icheck.min.js"></script>
<script src="../../rs/plugins/bootstrap_tab/js/plugins/layer/laydate/laydate.js"></script>
<script src="../../rs/plugins/bootstrap-editable/js/bootstrap-table-editable.min.js"></script>
<script type="text/javascript">
 




    var sign = URLencode($.cookie('sign'));
    var $table = $('#table');
 
    var mydata;
    $(function(){

        $('#table').bootstrapTable({
            columns: [
                {
                    field: 'state',
                    checkbox: true
                },

                {
                    field: 'djbh',
                    title: '单据编号',
                    align: 'left',
                     
                },
                {
                    field: 'djje',
                    align: 'left',

                    title: '单据金额'
                },
                {
                    field: 'mc1',
                    align: 'center',
                    title: '仓库',

                },
                {
                    field: 'mc2',
                    align: 'center',
                    title: '客户',

                },
                
                {
                    field: 'lx',
                    align: 'center',
                    title: '单据类型',

                },


              
            ],
            singleSelect: false,
            pagination: true,
            pageSize:20
        });
        f_sheard();
    });


    function f_sheard() {

        layer.load(2);
        $.ajax({
            type: "post",
            url:G_url+'filg/dcl?sign='+sign,
            data:'sign='+sign,
            dataType: "json",
            success: function (aftdata) {
                mydata=aftdata.order;

                layer.closeAll('loading');
                $('#table').bootstrapTable('load', aftdata.order);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
            }
        });
    }


    
 

   

    
    <!--本地搜索-->
    $("#search").on("click",function(){
        alert("搜索");
    });

    $('#searchtext').bind('keypress',function(event){
        if(event.keyCode == "13") {
            do_search();
        }
    });

    function do_search(){
 
        var gjc=$('#searchtext').val(); //搜索关键词
        if(gjc==""){
           
            $table.bootstrapTable('load', mydata);
        }else{
            var newdata=[];
            for(var i=0;i<mydata.length;i++){
                str=transform(mydata[i]).join(',');
                row=str.indexOf(gjc);
                if(row>=0){
                    newdata.push(mydata[i]);
                }
            }
            $table.bootstrapTable('load', newdata);
        }
    }
    function transform(obj){
        var arr = [];
        for(var item in obj){
            arr.push(obj[item]);
        }
        return arr;
    }
    <!--本地搜索-->


     
 

 



function submit_djbh(zt){
    var djbhs = $.map($table.bootstrapTable('getSelections'), function (row) {
                return row.djbh;
            });
            if(djbhs.length==0){
                layer.msg("请选择单据！");
            }else{
                 $.ajax({
                type: "post",
                url:G_url+'filg/f_cl/'+ zt+'/?sign='+sign,
                data:"djbhs="+djbhs,
                dataType: "json",
                success: function (result){
                    if (result.ok){
                      f_sheard();
                      layer.msg(result.msg);
                    } else {
                        layer.msg(result.msg);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                }
            });
         }    
    }




</script>
</body>
</html>
